package cn.cdeden.knowledge.domain.dto;

import cn.cdeden.knowledge.domain.PersonalFilesTree;
import cn.cdeden.resource.api.domain.RemoteFilesUpload;
import com.alibaba.fastjson.JSONObject;
//import io.swagger.annotations.ApiModelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.multipart.MultipartFile;

//import javax.validation.constraints.NotNull;
//import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

/**
 * @ProjectName : ecm_hou
 * @Package : com.cdyd.ecm.modules.online.domain
 * @ClassName : FilesTreeUploadDto
 * @Author : Yu.
 * @Description : //  文件上传接收类
 * @Date : 2022/12/27 11:05
 * @Version : 1.0
 */
//@Builder
@ToString
@NoArgsConstructor
@AutoMappers({@AutoMapper(target = RemoteFilesUpload.class), @AutoMapper(target = PersonalFilesTree.class)})
public class FilesTreeUploadDto implements Serializable {
    private static final long serialVersionUID = 1L;
    @Getter
    @Setter
//    @ApiModelProperty(value = "文件")
    private MultipartFile file;


    @Getter
    @Setter
//    @ApiModelProperty(value = "文件上传的路径")
    private String filePath;

    @Getter
    @Setter
//    @ApiModelProperty(value = "文件封面")
    private MultipartFile coverImage;


    @Getter
    @Setter
//    @ApiModelProperty(value = "父编号")
    private String parentId;

    @Getter
    @Setter
//    @ApiModelProperty(value = "团队编号")
    private String teamId;

    @Getter
    @Setter
//    @ApiModelProperty(value = "是否继承权限")
    private String extend;

    @Getter
    @Setter
//    @ApiModelProperty(value = "生效日期")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private Date effectiveDate;

    @Getter
    @Setter
//    @ApiModelProperty(value = "过期日期")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private Date expirationDate;

    @Getter
    @Setter
//    @ApiModelProperty(value = "文件名称")
    @Pattern(regexp = "^.{0,216}$", message = "文件名称,最长为216个字符")
    @Pattern(regexp = "^[^/\\\\\\:\\*\\?\\\"\\<\\>\\|\\\\]{1,216}$", message = "文件名称,不能用 `\\/:*?\"<>|` 作为文件名称,最长为216位")
    private String fileName;

    @Getter
    @Setter
//    @ApiModelProperty(value = "备注")
    @Pattern(regexp = "^.{0,550}$", message = "文件名称,最长为550个字符")
    private String remarks;

//    @ApiModelProperty(value = "其他信息")
//    private JSONObject info;

    @Getter
    @Setter
//    @ApiModelProperty(value = "自定义参数")
    private String argument;

    @Getter
    @Setter
    @NotNull(message = "缺少必要上传文件参数")
//      @Pattern  enterprise personal team
    //后端 添加类型
    @Pattern(regexp = "enterprise|personal|team|tender|ferry|project|temp|contract|contractTemp|process|contractRelatedDoc|supplierAptitude|supplierDoc|supplierEventDoc|patentDoc", message = "上传文件参数错误")
//    @ApiModelProperty(name = "type", value = "类型 个人文件:personal 团队文件:team  企业文件:enterprise", dataType = "String", required = true)
    private String type;


//    public JSONObject getInfo() {
//        return info;
//    }
//
//    public void setInfo02(JSONObject info) {
//        this.info = info;
//    }
//
//    public void setInfo(String info) {
//        this.info = JSONObject.parseObject(info);
//    }



}
